home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / !Interfaces / Universal Interfaces 2.0a1 / PInterfaces / Serial.p < prev    next >
Encoding:
Text File  |  1994-07-17  |  2.7 KB  |  119 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        Serial.p
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a1.  ETO #15, MPW prerelease.  Sunday, July 17, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. }
  16.  
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT Serial;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __SERIAL__}
  27. {$SETC __SERIAL__ := 1}
  28.  
  29. {$I+}
  30. {$SETC SerialIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {    ConditionalMacros.p                                            }
  38.  
  39. {$PUSH}
  40. {$ALIGN MAC68K}
  41. {$LibExport+}
  42.  
  43. CONST
  44.     baud300                        = 380;
  45.     baud600                        = 189;
  46.     baud1200                    = 94;
  47.     baud1800                    = 62;
  48.     baud2400                    = 46;
  49.     baud3600                    = 30;
  50.     baud4800                    = 22;
  51.     baud7200                    = 14;
  52.     baud9600                    = 10;
  53.     baud19200                    = 4;
  54.     baud57600                    = 0;
  55.     stop10                        = 16384;
  56.     stop15                        = -32768;
  57.     stop20                        = -16384;
  58.     noParity                    = 0;
  59.     oddParity                    = 4096;
  60.     evenParity                    = 12288;
  61.     data5                        = 0;
  62.     data6                        = 2048;
  63.     data7                        = 1024;
  64.     data8                        = 3072;
  65.  
  66.     ctsEvent                    = 32;
  67.     breakEvent                    = 128;
  68.     xOffWasSent                    = 128;
  69.     dtrNegated                    = 64;
  70.     ainRefNum                    = -6;                            {serial port A input}
  71.     aoutRefNum                    = -7;                            {serial port A output}
  72.     binRefNum                    = -8;                            {serial port B input}
  73.     boutRefNum                    = -9;                            {serial port B output}
  74.  
  75.     sPortA                        = 0;
  76.     sPortB                        = 1;
  77.  
  78.     
  79. TYPE
  80. SPortSel = SInt8;
  81.  
  82.     SerShk = PACKED RECORD
  83.         fXOn:                    Byte;                                    {XOn flow control enabled flag}
  84.         fCTS:                    Byte;                                    {CTS flow control enabled flag}
  85.         xOn:                    CHAR;                                    {XOn character}
  86.         xOff:                    CHAR;                                    {XOff character}
  87.         errs:                    Byte;                                    {errors mask bits}
  88.         evts:                    Byte;                                    {event enable mask bits}
  89.         fInX:                    Byte;                                    {Input flow control enabled flag}
  90.         fDTR:                    Byte;                                    {DTR input flow control flag}
  91.     END;
  92.     SerStaRec = PACKED RECORD
  93.         cumErrs:                Byte;
  94.         xOffSent:                Byte;
  95.         rdPend:                    Byte;
  96.         wrPend:                    Byte;
  97.         ctsHold:                Byte;
  98.         xOffHold:                Byte;
  99.     END;
  100.  
  101. FUNCTION SerReset(refNum: INTEGER; serConfig: INTEGER): OSErr;
  102. FUNCTION SerSetBuf(refNum: INTEGER; serBPtr: Ptr; serBLen: INTEGER): OSErr;
  103. FUNCTION SerHShake(refNum: INTEGER; flags: SerShk): OSErr;
  104. FUNCTION SerSetBrk(refNum: INTEGER): OSErr;
  105. FUNCTION SerClrBrk(refNum: INTEGER): OSErr;
  106. FUNCTION SerGetBuf(refNum: INTEGER; VAR count: LONGINT): OSErr;
  107. FUNCTION SerStatus(refNum: INTEGER; VAR serSta: SerStaRec): OSErr;
  108.  
  109. {$ALIGN RESET}
  110. {$POP}
  111.  
  112. {$SETC UsingIncludes := SerialIncludes}
  113.  
  114. {$ENDC} {__SERIAL__}
  115.  
  116. {$IFC NOT UsingIncludes}
  117.  END.
  118. {$ENDC}
  119.